/*
 * @lc app=leetcode.cn id=643 lang=javascript
 *
 * [643] 子数组最大平均数 I
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number}
 */
var findMaxAverage = function(nums, k) {
    let maxValue = -Infinity
    for (let index1 = 0; index1 <= nums.length - k; index1++) {
        let value = 0
        for (let index2 = 0; index2 < k && index1 + k <= nums.length; index2++) {
            value += nums[index1 + index2];
        }
        value = value / k
        maxValue = Math.max(maxValue, value)
    }
    return maxValue
};
// @lc code=end

